<include file="../header" />
<head>
	<link rel="stylesheet" href="/assets/base/repair/js/sweetalert/lib/sweet-alert.css">
</head>
<body>
<div class="wraper">
	<div class="top">
		<p>选择就餐时间</p>
	</div>
	<div class="datalist">
		<div class="order-dtl">
			<volist name="data" id="vo">
				<p class="eatTime" data-idx="{BEESCRM:$vo.id}" data-start="{BEESCRM:$vo.eatStart}" data-end="{BEESCRM:$vo.eatEnd}" style="text-align: center;border:1px #d8d5d5 solid;background-color: #eef3f0;cursor:pointer;">
					{BEESCRM:$vo.eatStart}-{BEESCRM:$vo.eatEnd}
				</p>
			</volist>
		</div>
		<div class="wave-bottom"></div>
	</div>
	<input type="hidden" id="irs_id" value="{BEESCRM:$res_id}">
	<input type="hidden" id="restaurant_id" value="{BEESCRM:$restaurantId}">
	<input type="hidden" id="window_id" value="{BEESCRM:$windowId}">
</div>

<include file="../commonJS" />

<script>
	$(function(){
		$(document).on('click','.eatTime',function(){
			var irs_id    = $("#irs_id").val();
			var restaurant_id = $("#restaurant_id").val();
			var window_id = $("#window_id").val();
			var start = $(this).data('start');
			var end   = $(this).data('end');
			var info = {};
			var json = {};
			info.start = start;
			info.end = end;
			info.restaurant_id = restaurant_id;
			$.ajax({
				'url': "/Schoolirs/BookDinner/setEatTime/refectory_id/"+restaurant_id+"/window_id/"+window_id+"/res_id/"+irs_id,
				'data': info,
				'dataType':'json',
				'type': 'POST',
				'async': false,
				success: function(data) {
					if (data.status == 'S') {
						location.href = data.uri;
					}else{
						$.alert('error',data.message);
						return false;
					}
				}
			});
		});
	});

	//页面刷新
	function reload(){
		setTimeout('location.reload()',1000);
	}

</script>
</body>
</html>
